<form name="frmAddCompany" method="post" action="/company/save-company" onsubmit="return checkValid()">
<input type="hidden" name="company_id" id="company_id" value="<?php echo @$this->company['company_id'];?>"/>
<input type="hidden" name="contact_person_id" id="contact_person_id" value="<?php echo @$this->company['contact_person_id'];?>"/>
<div class="from-add-01" style="100%">
<div style="width:50%;float:left;">
<ul >
	<li>
		<h2><?php echo $this->title;?></h2>
	</li>
	<li>
			<label>&nbsp;</label>
			<em class="error"></em>
	</li>
	<li>
		<label>Company Name:<em>*</em></label>
		<label><input type="text" name="company_name" id="company_name" value="<?php echo @$this->company['company_name'];?>"></label>
	</li>
	<li>
		<label>Business Type:</label>		
		<input type="text" name="busines_type" id="busines_type" value="<?php echo @$this->company['busines_type'];?>">						
	</li>
	<li>
		<label>Telephone:</label>
		<input type="text" name="tel" id="tel" value="<?php echo @$this->company['tel'];?>">
		Ex: 848 38243 780 Ext. 123
	</li>
	<li>
		<label>Email:</label>
		<label><input type="text" name="email" id="email" value="<?php echo @$this->company['email'];?>"></label>
	</li>
	<li>
		<label>Address:</label>
		<label>
			<input type="text" name="address" id="address" value="<?php echo @$this->company['address'];?>">
		</label>
	</li>
	<li>
		<label>Website:</label>
		<label><input type="text" name="website" id="website" value="<?php echo @$this->company['website'];?>"></label>
	</li>
	<li>
		<label>Company information<br />
		(for internal reference)
		</label>
		<label>
			<textarea name="information" rows="6" id="information" style="width:300px"><?php echo @$this->company['information'];?></textarea>
		</label>
	</li>
	<li>
		<label>Assign Consultant:</label>
		<label><input type="text" name="assign_cons" id="assign_cons" value="<?php echo @$this->company['assign_cons'];?>"></label>
	</li>
	<li>
		 <label></label>
         <a href="/company" style="text-decoration:none;">
            <input class="button02" type="button" name="cancel" id="cancel" value="Cancel">
        </a>
         <input class="button01" type="submit" name="save" id="save" value="Save">
	</li>
</ul>
</div>
<div style="width:40%; float:left;">
<input type="hidden" name="contact_person_id"  id="contact_person_id" value="<?php echo @$this->company['contact_person_id']; ?>"/>
<ul >
	<li>
		<h2>ADD CONTACT</h2>
	</li>
		<li>
			<label>&nbsp;</label>
			<em></em>
	</li>
	<li>
		<label>Full Name:</label>
			<select name="title" id="title" style="width:60px;">
				<option value="Mr.">Mr.</option>
				<option value="Mrs.">Mrs.</option>
				<option value="ms.">Ms.</option>
			</select>
			<input type="text" name="full_name" id="full_name" value="<?php echo @$this->company['full_name']; ?>">
		
	</li>
	<li>
		<label>Job Title:</label>
		<label><input type="text" name="job_title" id="job_title" value="<?php echo @$this->company['job_title']; ?>"></label>
	</li>
	<li>
		<label>Mobile:</label>
		<label><input type="text" name="ct_mobile" id="ct_mobile" value="<?php echo @$this->company['mobile']; ?>"></label>
	</li>
	<li>
		<label>Email:</label>
		<label><input type="text" name="ct_email" id="ct_email" value="<?php echo @$this->company['ct_email']; ?>"></label>
	</li>
</ul>
</div>
</div>
</form>
<script>
function checkValid()
{
	var company_name = $("#company_name").val();
	
    var email = $('#email').val();

    if(company_name == '') {
        $('.error').html('Please input into field required (*)');
        return false;
    }

    var check = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
    if(!check.test(email))
    {
    	$('.error').html('Email company invalid');
    	return false;
    }

    var ct_email = $('#ct_email').val();
    if(!check.test(ct_email))
    {
    	$('.error').html('Email contact invalid');
    	return false;
    }
    
    return true;
}   
</script>

	



